import React from 'react';

export default function ESGPlatformERDiagram() {
  return (
    <div className="w-full min-h-screen bg-gray-50 p-6">
      <div className="max-w-full overflow-x-auto">
        <div className="min-w-max">
          <h1 className="text-3xl font-bold text-center mb-8 text-gray-800">
            AI驱动一站式ESG服务平台 - 核心数据模型ER图
          </h1>
          
          <svg width="2800" height="2000" viewBox="0 0 2800 2000" className="border border-gray-300 bg-white rounded-lg shadow-lg">
            {/* 定义箭头标记和样式 */}
            <defs>
              <marker id="arrowhead" markerWidth="10" markerHeight="7" 
                      refX="9" refY="3.5" orient="auto">
                <polygon points="0 0, 10 3.5, 0 7" fill="#333" />
              </marker>
              <marker id="primaryArrow" markerWidth="10" markerHeight="7" 
                      refX="9" refY="3.5" orient="auto">
                <polygon points="0 0, 10 3.5, 0 7" fill="#1976d2" />
              </marker>
              <filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
                <feDropShadow dx="2" dy="2" stdDeviation="3" floodColor="rgba(0,0,0,0.1)"/>
              </filter>
            </defs>
            
            {/* 分层标签 */}
            <text x="50" y="40" fontSize="16" fontWeight="bold" fill="#1976d2">第一层：组织核心层</text>
            <text x="50" y="340" fontSize="16" fontWeight="bold" fill="#388e3c">第二层：运营活动层</text>
            <text x="50" y="740" fontSize="16" fontWeight="bold" fill="#d32f2f">第三层：排放计算层</text>
            <text x="50" y="1040" fontSize="16" fontWeight="bold" fill="#7b1fa2">第四层：合规治理层</text>
            <text x="50" y="1440" fontSize="16" fontWeight="bold" fill="#f57c00">第五层：支撑服务层</text>
            
            {/* 第一层：组织核心层 */}
            
            {/* Organization - 核心中心节点 */}
            <g transform="translate(400, 70)">
              <rect width="320" height="200" fill="#e3f2fd" stroke="#1976d2" strokeWidth="3" rx="8" filter="url(#shadow)"/>
              <rect width="320" height="35" fill="#1976d2" rx="8"/>
              <text x="160" y="25" textAnchor="middle" fill="white" fontSize="16" fontWeight="bold">Organization (组织)</text>
              <text x="10" y="55" fontSize="12" fontWeight="bold" fill="#1976d2">org_id (UUID, PK)</text>
              <text x="10" y="70" fontSize="11" fill="#333">company_code (String, UNIQUE)</text>
              <text x="10" y="85" fontSize="11" fill="#333">org_name (String)</text>
              <text x="10" y="100" fontSize="11" fill="#333">parent_company_code (String)</text>
              <text x="10" y="115" fontSize="11" fill="#333">industry_code (String, FK)</text>
              <text x="10" y="130" fontSize="11" fill="#333">registration_country_code (String, FK)</text>
              <text x="10" y="145" fontSize="11" fill="#333">company_size_category (String)</text>
              <text x="10" y="160" fontSize="11" fill="#333">reporting_cycle_type (String)</text>
              <text x="10" y="175" fontSize="11" fill="#333">esg_strategy_summary (Text)</text>
            </g>
            
            {/* ESGProject - 项目管理 */}
            <g transform="translate(800, 70)">
              <rect width="300" height="200" fill="#e8f5e8" stroke="#388e3c" strokeWidth="2" rx="5"/>
              <rect width="300" height="30" fill="#388e3c" rx="5"/>
              <text x="150" y="20" textAnchor="middle" fill="white" fontSize="14" fontWeight="bold">ESGProject (ESG项目)</text>
              <text x="10" y="45" fontSize="11" fontWeight="bold" fill="#388e3c">project_id (UUID, PK)</text>
              <text x="10" y="60" fontSize="11" fill="#333">project_code (String, UNIQUE)</text>
              <text x="10" y="75" fontSize="11" fill="#333">project_name (String)</text>
              <text x="10" y="90" fontSize="11" fill="#333">company_code (String, FK)</text>
              <text x="10" y="105" fontSize="11" fill="#333">project_type (String)</text>
              <text x="10" y="120" fontSize="11" fill="#333">reporting_period_start/end (Date)</text>
              <text x="10" y="135" fontSize="11" fill="#333">assessment_standard (String)</text>
              <text x="10" y="150" fontSize="11" fill="#333">project_status (String)</text>
              <text x="10" y="165" fontSize="11" fill="#333">verification_required (Boolean)</text>
            </g>
            
            {/* Product */}
            <g transform="translate(1200, 70)">
              <rect width="280" height="200" fill="#fff3e0" stroke="#f57c00" strokeWidth="2" rx="5"/>
              <rect width="280" height="30" fill="#f57c00" rx="5"/>
              <text x="140" y="20" textAnchor="middle" fill="white" fontSize="14" fontWeight="bold">Product (产品)</text>
              <text x="10" y="45" fontSize="11" fontWeight="bold" fill="#f57c00">product_id (UUID, PK)</text>
              <text x="10" y="60" fontSize="11" fill="#333">product_code (String, UNIQUE)</text>
              <text x="10" y="75" fontSize="11" fill="#333">product_name (String)</text>
              <text x="10" y="90" fontSize="11" fill="#333">product_type (String)</text>
              <text x="10" y="105" fontSize="11" fill="#333">lifecycle_stage (String)</text>
              <text x="10" y="120" fontSize="11" fill="#333">function_unit (String)</text>
              <text x="10" y="135" fontSize="11" fill="#333">year_output (Decimal)</text>
              <text x="10" y="150" fontSize="11" fill="#333">hs_code (String)</text>
              <text x="10" y="165" fontSize="11" fill="#333">data_quality (String)</text>
            </g>
            
            {/* 第二层：运营活动层 */}
            
            {/* OperationalEntity */}
            <g transform="translate(200, 370)">
              <rect width="300" height="200" fill="#e8f5e8" stroke="#388e3c" strokeWidth="2" rx="5"/>
              <rect width="300" height="30" fill="#388e3c" rx="5"/>
              <text x="150" y="20" textAnchor="middle" fill="white" fontSize="14" fontWeight="bold">OperationalEntity (运营实体)</text>
              <text x="10" y="45" fontSize="11" fontWeight="bold" fill="#388e3c">entity_id (UUID, PK)</text>
              <text x="10" y="60" fontSize="11" fill="#333">facility_code (String, UNIQUE)</text>
              <text x="10" y="75" fontSize="11" fill="#333">entity_name (String)</text>
              <text x="10" y="90" fontSize="11" fill="#333">entity_type (String)</text>
              <text x="10" y="105" fontSize="11" fill="#333">latitude, longitude (Decimal)</text>
              <text x="10" y="120" fontSize="11" fill="#333">area_sqm (Float)</text>
              <text x="10" y="135" fontSize="11" fill="#333">production_capacity (Decimal)</text>
              <text x="10" y="150" fontSize="11" fill="#333">operational_boundary (String)</text>
              <text x="10" y="165" fontSize="11" fill="#333">facility_status (String)</text>
            </g>
            
            {/* Activity - 核心活动数据 */}
            <g transform="translate(600, 370)">
              <rect width="350" height="200" fill="#f3e5f5" stroke="#7b1fa2" strokeWidth="3" rx="8" filter="url(#shadow)"/>
              <rect width="350" height="35" fill="#7b1fa2" rx="8"/>
              <text x="175" y="25" textAnchor="middle" fill="white" fontSize="16" fontWeight="bold">Activity (活动数据)</text>
              <text x="10" y="55" fontSize="12" fontWeight="bold" fill="#7b1fa2">activity_id (UUID, PK)</text>
              <text x="10" y="70" fontSize="11" fill="#333">activity_code (String, UNIQUE)</text>
              <text x="10" y="85" fontSize="11" fill="#333">activity_type (String)</text>
              <text x="10" y="100" fontSize="11" fill="#333">activity_name (String)</text>
              <text x="10" y="115" fontSize="11" fill="#333">activity_value (Decimal)</text>
              <text x="10" y="130" fontSize="11" fill="#333">activity_unit (String, FK)</text>
              <text x="190" y="70" fontSize="11" fill="#333">period_start/end (Date)</text>
              <text x="190" y="85" fontSize="11" fill="#333">data_source_system (String)</text>
              <text x="190" y="100" fontSize="11" fill="#333">confidence_score (Integer)</text>
              <text x="190" y="115" fontSize="11" fill="#333">data_quality (String)</text>
              <text x="190" y="130" fontSize="11" fill="#333">is_estimated (Boolean)</text>
            </g>
            
            {/* Material & Supplier */}
            <g transform="translate(1050, 370)">
              <rect width="250" height="120" fill="#fce4ec" stroke="#c2185b" strokeWidth="2" rx="5"/>
              <rect width="250" height="25" fill="#c2185b" rx="5"/>
              <text x="125" y="18" textAnchor="middle" fill="white" fontSize="13" fontWeight="bold">Material (物料)</text>
              <text x="10" y="40" fontSize="11" fontWeight="bold" fill="#c2185b">material_id (UUID, PK)</text>
              <text x="10" y="55" fontSize="11" fill="#333">material_code (String)</text>
              <text x="10" y="70" fontSize="11" fill="#333">material_type (String)</text>
              <text x="10" y="85" fontSize="11" fill="#333">is_recycled_content (Boolean)</text>
              <text x="10" y="100" fontSize="11" fill="#333">default_pcf_kgco2e_per_kg (Float)</text>
            </g>
            
            <g transform="translate(1050, 510)">
              <rect width="250" height="100" fill="#e8eaf6" stroke="#3f51b5" strokeWidth="2" rx="5"/>
              <rect width="250" height="25" fill="#3f51b5" rx="5"/>
              <text x="125" y="18" textAnchor="middle" fill="white" fontSize="13" fontWeight="bold">Supplier (供应商)</text>
              <text x="10" y="40" fontSize="11" fontWeight="bold" fill="#3f51b5">supplier_id (UUID, PK)</text>
              <text x="10" y="55" fontSize="11" fill="#333">supplier_name (String)</text>
              <text x="10" y="70" fontSize="11" fill="#333">esg_rating_ecovadis (String)</text>
              <text x="10" y="85" fontSize="11" fill="#333">supplier_location (String)</text>
            </g>
            
            {/* 第三层：排放计算层 */}
            
            {/* EmissionFactor */}
            <g transform="translate(200, 770)">
              <rect width="320" height="180" fill="#e0f2f1" stroke="#00695c" strokeWidth="2" rx="5"/>
              <rect width="320" height="30" fill="#00695c" rx="5"/>
              <text x="160" y="20" textAnchor="middle" fill="white" fontSize="14" fontWeight="bold">EmissionFactor (排放因子)</text>
              <text x="10" y="45" fontSize="11" fontWeight="bold" fill="#00695c">factor_id (UUID, PK)</text>
              <text x="10" y="60" fontSize="11" fill="#333">factor_code (String, UNIQUE)</text>
              <text x="10" y="75" fontSize="11" fill="#333">factor_name (String)</text>
              <text x="10" y="90" fontSize="11" fill="#333">factor_category (String)</text>
              <text x="10" y="105" fontSize="11" fill="#333">emission_factor_co2 (Decimal)</text>
              <text x="10" y="120" fontSize="11" fill="#333">emission_factor_ch4 (Decimal)</text>
              <text x="10" y="135" fontSize="11" fill="#333">geographic_scope (String)</text>
              <text x="10" y="150" fontSize="11" fill="#333">source (String)</text>
              <text x="10" y="165" fontSize="11" fill="#333">valid_from/to (Date)</text>
            </g>
            
            {/* GHGEmissionsResult - 核心计算结果 */}
            <g transform="translate(600, 770)">
              <rect width="380" height="180" fill="#ffebee" stroke="#d32f2f" strokeWidth="3" rx="8" filter="url(#shadow)"/>
              <rect width="380" height="35" fill="#d32f2f" rx="8"/>
              <text x="190" y="25" textAnchor="middle" fill="white" fontSize="16" fontWeight="bold">GHGEmissionsResult (排放计算结果)</text>
              <text x="10" y="55" fontSize="12" fontWeight="bold" fill="#d32f2f">calculation_result_id (UUID, PK)</text>
              <text x="10" y="70" fontSize="11" fill="#333">calculation_code (String, UNIQUE)</text>
              <text x="10" y="85" fontSize="11" fill="#333">calculation_type (String)</text>
              <text x="10" y="100" fontSize="11" fill="#333">co2_emission (Decimal)</text>
              <text x="10" y="115" fontSize="11" fill="#333">total_co2_equivalent (Decimal)</text>
              <text x="10" y="130" fontSize="11" fill="#333">calculation_method (String)</text>
              <text x="200" y="70" fontSize="11" fill="#333">emission_category (String)</text>
              <text x="200" y="85" fontSize="11" fill="#333">activity_data (Decimal)</text>
              <text x="200" y="100" fontSize="11" fill="#333">emission_factor (Decimal)</text>
              <text x="200" y="115" fontSize="11" fill="#333">data_quality (String)</text>
              <text x="200" y="130" fontSize="11" fill="#333">calculation_date (Datetime)</text>
            </g>
            
            {/* CarbonAsset */}
            <g transform="translate(1050, 770)">
              <rect width="280" height="180" fill="#e8f5e8" stroke="#2e7d32" strokeWidth="2" rx="5"/>
              <rect width="280" height="30" fill="#2e7d32" rx="5"/>
              <text x="140" y="20" textAnchor="middle" fill="white" fontSize="14" fontWeight="bold">CarbonAsset (碳资产)</text>
              <text x="10" y="45" fontSize="11" fontWeight="bold" fill="#2e7d32">asset_id (UUID, PK)</text>
              <text x="10" y="60" fontSize="11" fill="#333">asset_type (String)</text>
              <text x="10" y="75" fontSize="11" fill="#333">quantity (Float)</text>
              <text x="10" y="90" fontSize="11" fill="#333">purchase_date (Date)</text>
              <text x="10" y="105" fontSize="11" fill="#333">issuing_body (String)</text>
              <text x="10" y="120" fontSize="11" fill="#333">project_name (String)</text>
              <text x="10" y="135" fontSize="11" fill="#333">retirement_date (Date)</text>
              <text x="10" y="150" fontSize="11" fill="#333">status (String)</text>
            </g>
            
            {/* 第四层：合规治理层 */}
            
            {/* RegulationStandardInitiative */}
            <g transform="translate(200, 1070)">
              <rect width="320" height="180" fill="#e1f5fe" stroke="#0277bd" strokeWidth="2" rx="5"/>
              <rect width="320" height="30" fill="#0277bd" rx="5"/>
              <text x="160" y="20" textAnchor="middle" fill="white" fontSize="14" fontWeight="bold">RegulationStandardInitiative</text>
              <text x="10" y="45" fontSize="11" fontWeight="bold" fill="#0277bd">reg_std_id (UUID, PK)</text>
              <text x="10" y="60" fontSize="11" fill="#333">name (String)</text>
              <text x="10" y="75" fontSize="11" fill="#333">type (String)</text>
              <text x="10" y="90" fontSize="11" fill="#333">applicable_scope (String)</text>
              <text x="10" y="105" fontSize="11" fill="#333">version (String)</text>
              <text x="10" y="120" fontSize="11" fill="#333">effective_date (Date)</text>
              <text x="10" y="135" fontSize="11" fill="#333">official_url (String)</text>
              <text x="10" y="150" fontSize="11" fill="#333">summary_description (Text)</text>
            </g>
            
            {/* ComplianceRecord */}
            <g transform="translate(600, 1070)">
              <rect width="320" height="180" fill="#f1f8e9" stroke="#689f38" strokeWidth="2" rx="5"/>
              <rect width="320" height="30" fill="#689f38" rx="5"/>
              <text x="160" y="20" textAnchor="middle" fill="white" fontSize="14" fontWeight="bold">ComplianceRecord (合规记录)</text>
              <text x="10" y="45" fontSize="11" fontWeight="bold" fill="#689f38">compliance_id (UUID, PK)</text>
              <text x="10" y="60" fontSize="11" fill="#333">compliance_code (String, UNIQUE)</text>
              <text x="10" y="75" fontSize="11" fill="#333">compliance_type (String)</text>
              <text x="10" y="90" fontSize="11" fill="#333">compliance_status (String)</text>
              <text x="10" y="105" fontSize="11" fill="#333">deadline_date (Date)</text>
              <text x="10" y="120" fontSize="11" fill="#333">certificate_number (String)</text>
              <text x="10" y="135" fontSize="11" fill="#333">responsible_person (String)</text>
              <text x="10" y="150" fontSize="11" fill="#333">total_amount (Decimal)</text>
            </g>
            
            {/* ESGGoal & ESGMetricDefinition */}
            <g transform="translate(1000, 1070)">
              <rect width="260" height="120" fill="#fff8e1" stroke="#ff8f00" strokeWidth="2" rx="5"/>
              <rect width="260" height="25" fill="#ff8f00" rx="5"/>
              <text x="130" y="18" textAnchor="middle" fill="white" fontSize="13" fontWeight="bold">ESGGoal (ESG目标)</text>
              <text x="10" y="40" fontSize="11" fontWeight="bold" fill="#ff8f00">goal_id (UUID, PK)</text>
              <text x="10" y="55" fontSize="11" fill="#333">goal_type (String)</text>
              <text x="10" y="70" fontSize="11" fill="#333">baseline_value (Float)</text>
              <text x="10" y="85" fontSize="11" fill="#333">target_value (Float)</text>
              <text x="10" y="100" fontSize="11" fill="#333">status (String)</text>
            </g>
            
            <g transform="translate(1000, 1210)">
              <rect width="260" height="120" fill="#f3e5f5" stroke="#8e24aa" strokeWidth="2" rx="5"/>
              <rect width="260" height="25" fill="#8e24aa" rx="5"/>
              <text x="130" y="18" textAnchor="middle" fill="white" fontSize="13" fontWeight="bold">ESGMetricDefinition</text>
              <text x="10" y="40" fontSize="11" fontWeight="bold" fill="#8e24aa">metric_id (UUID, PK)</text>
              <text x="10" y="55" fontSize="11" fill="#333">indicator_code (String)</text>
              <text x="10" y="70" fontSize="11" fill="#333">metric_name (String)</text>
              <text x="10" y="85" fontSize="11" fill="#333">framework (String)</text>
              <text x="10" y="100" fontSize="11" fill="#333">calculation_formula (String)</text>
            </g>
            
            {/* ActionPlan */}
            <g transform="translate(1320, 1070)">
              <rect width="280" height="180" fill="#e0f7fa" stroke="#00838f" strokeWidth="2" rx="5"/>
              <rect width="280" height="30" fill="#00838f" rx="5"/>
              <text x="140" y="20" textAnchor="middle" fill="white" fontSize="14" fontWeight="bold">ActionPlan (行动计划)</text>
              <text x="10" y="45" fontSize="11" fontWeight="bold" fill="#00838f">action_id (UUID, PK)</text>
              <text x="10" y="60" fontSize="11" fill="#333">action_description (Text)</text>
              <text x="10" y="75" fontSize="11" fill="#333">responsible_user_id (UUID, FK)</text>
              <text x="10" y="90" fontSize="11" fill="#333">due_date (Date)</text>
              <text x="10" y="105" fontSize="11" fill="#333">status (String)</text>
              <text x="10" y="120" fontSize="11" fill="#333">expected_ghg_reduction (Float)</text>
              <text x="10" y="135" fontSize="11" fill="#333">estimated_cost_eur (Float)</text>
              <text x="10" y="150" fontSize="11" fill="#333">related_risk_id (UUID, FK)</text>
            </g>
            
            {/* 第五层：支撑服务层 */}
            
            {/* ReportTemplateDefinition */}
            <g transform="translate(200, 1470)">
              <rect width="280" height="150" fill="#fff3e0" stroke="#e65100" strokeWidth="2" rx="5"/>
              <rect width="280" height="25" fill="#e65100" rx="5"/>
              <text x="140" y="18" textAnchor="middle" fill="white" fontSize="13" fontWeight="bold">ReportTemplateDefinition</text>
              <text x="10" y="40" fontSize="11" fontWeight="bold" fill="#e65100">template_id (UUID, PK)</text>
              <text x="10" y="55" fontSize="11" fill="#333">template_code (String)</text>
              <text x="10" y="70" fontSize="11" fill="#333">report_type (String)</text>
              <text x="10" y="85" fontSize="11" fill="#333">report_framework (String)</text>
              <text x="10" y="100" fontSize="11" fill="#333">template_structure (JSONB)</text>
              <text x="10" y="115" fontSize="11" fill="#333">template_status (String)</text>
              <text x="10" y="130" fontSize="11" fill="#333">applicable_industry (String)</text>
            </g>
            
            {/* FileInfo */}
            <g transform="translate(550, 1470)">
              <rect width="250" height="150" fill="#f5f5f5" stroke="#616161" strokeWidth="2" rx="5"/>
              <rect width="250" height="25" fill="#616161" rx="5"/>
              <text x="125" y="18" textAnchor="middle" fill="white" fontSize="13" fontWeight="bold">FileInfo (文件信息)</text>
              <text x="10" y="40" fontSize="11" fontWeight="bold" fill="#616161">file_id (UUID, PK)</text>
              <text x="10" y="55" fontSize="11" fill="#333">file_code (String, UNIQUE)</text>
              <text x="10" y="70" fontSize="11" fill="#333">filename (String)</text>
              <text x="10" y="85" fontSize="11" fill="#333">file_type (String)</text>
              <text x="10" y="100" fontSize="11" fill="#333">parse_status (String)</text>
              <text x="10" y="115" fontSize="11" fill="#333">parse_result (JSONB)</text>
              <text x="10" y="130" fontSize="11" fill="#333">file_size (BigInt)</text>
            </g>
            
            {/* RatingIndicatorDefinition */}
            <g transform="translate(850, 1470)">
              <rect width="280" height="150" fill="#e8eaf6" stroke="#3f51b5" strokeWidth="2" rx="5"/>
              <rect width="280" height="25" fill="#3f51b5" rx="5"/>
              <text x="140" y="18" textAnchor="middle" fill="white" fontSize="13" fontWeight="bold">RatingIndicatorDefinition</text>
              <text x="10" y="40" fontSize="11" fontWeight="bold" fill="#3f51b5">rating_indicator_id (UUID, PK)</text>
              <text x="10" y="55" fontSize="11" fill="#333">indicator_code (String)</text>
              <text x="10" y="70" fontSize="11" fill="#333">rating_system (String)</text>
              <text x="10" y="85" fontSize="11" fill="#333">indicator_category (String)</text>
              <text x="10" y="100" fontSize="11" fill="#333">weight (Decimal)</text>
              <text x="10" y="115" fontSize="11" fill="#333">max_score (Decimal)</text>
              <text x="10" y="130" fontSize="11" fill="#333">scoring_method (String)</text>
            </g>
            
            {/* Lookup Tables 区域 */}
            <g transform="translate(1200, 1470)">
              <rect width="500" height="150" fill="#f0f0f0" stroke="#757575" strokeWidth="2" rx="5"/>
              <rect width="500" height="25" fill="#757575" rx="5"/>
              <text x="250" y="18" textAnchor="middle" fill="white" fontSize="13" fontWeight="bold">Lookup Tables & Junction Tables</text>
              <text x="20" y="45" fontSize="11" fill="#333">• IndustrySectorLookup - 行业分类标准</text>
              <text x="20" y="60" fontSize="11" fill="#333">• CountryLookup - 国家/地区代码</text>
              <text x="20" y="75" fontSize="11" fill="#333">• UnitLookup - 计量单位标准</text>
              <text x="20" y="90" fontSize="11" fill="#333">• ActivityTypeLookup - 活动类型分类</text>
              <text x="20" y="105" fontSize="11" fill="#333">• ProductMaterialComponent - 产品物料组成</text>
              <text x="270" y="45" fontSize="11" fill="#333">• Scope3CategoryLookup - Scope3分类</text>
              <text x="270" y="60" fontSize="11" fill="#333">• OrgCompliance - 组织合规关联</text>
              <text x="270" y="75" fontSize="11" fill="#333">• EmissionOffset - 排放抵消关联</text>
              <text x="270" y="90" fontSize="11" fill="#333">• UserLookup - 用户权限管理</text>
              <text x="270" y="105" fontSize="11" fill="#333">• FileSegment - 文件分片存储</text>
            </g>
            
            {/* 核心数据流关系线 - 使用更粗的线条和不同颜色 */}
            
            {/* 组织到项目 */}
            <line x1="720" y1="170" x2="800" y2="170" stroke="#1976d2" strokeWidth="3" markerEnd="url(#primaryArrow)"/>
            <text x="740" y="165" fontSize="10" fontWeight="bold" fill="#1976d2">manages</text>
            
            {/* 组织到运营实体 */}
            <line x1="500" y1="270" x2="350" y2="370" stroke="#1976d2" strokeWidth="3" markerEnd="url(#primaryArrow)"/>
            <text x="400" y="320" fontSize="10" fontWeight="bold" fill="#1976d2">owns</text>
            
            {/* 组织到产品 */}
            <line x1="720" y1="120" x2="1200" y2="120" stroke="#1976d2" strokeWidth="2" markerEnd="url(#arrowhead)"/>
            <text x="930" y="115" fontSize="10" fill="#666">produces</text>
            
            {/* 运营实体到活动 */}
            <line x1="500" y1="470" x2="600" y2="470" stroke="#388e3c" strokeWidth="3" markerEnd="url(#arrowhead)"/>
            <text x="530" y="465" fontSize="10" fontWeight="bold" fill="#388e3c">performs</text>
            
            {/* 活动到排放计算 */}
            <line x1="775" y1="570" x2="775" y2="770" stroke="#7b1fa2" strokeWidth="4" markerEnd="url(#arrowhead)"/>
            <text x="785" y="670" fontSize="12" fontWeight="bold" fill="#7b1fa2">generates</text>
            
            {/* 排放因子到排放计算 */}
            <line x1="520" y1="860" x2="600" y2="860" stroke="#00695c" strokeWidth="2" markerEnd="url(#arrowhead)"/>
            <text x="540" y="855" fontSize="10" fill="#666">provides factors</text>
            
            {/* 项目到合规记录 */}
            <line x1="950" y1="270" x2="950" y2="1000" stroke="#388e3c" strokeWidth="2" fill="none"/>
            <line x1="950" y1="1000" x2="760" y2="1000" stroke="#388e3c" strokeWidth="2" fill="none"/>
            <line x1="760" y1="1000" x2="760" y2="1070" stroke="#388e3c" strokeWidth="2" markerEnd="url(#arrowhead)"/>
            <text x="850" y="995" fontSize="10" fill="#666">tracks compliance</text>
            
            {/* 组织到ESG目标 */}
            <line x1="600" y1="270" x2="600" y2="1000" stroke="#1976d2" strokeWidth="2" fill="none"/>
            <line x1="600" y1="1000" x2="1000" y2="1000" stroke="#1976d2" strokeWidth="2" fill="none"/>
            <line x1="1000" y1="1000" x2="1130" y2="1070" stroke="#1976d2" strokeWidth="2" markerEnd="url(#arrowhead)"/>
            <text x="750" y="995" fontSize="10" fill="#666">sets goals</text>
            
            {/* 产品到物料 */}
            <line x1="1340" y1="270" x2="1340" y2="330" stroke="#f57c00" strokeWidth="2" fill="none"/>
            <line x1="1340" y1="330" x2="1175" y2="330" stroke="#f57c00" strokeWidth="2" fill="none"/>
            <line x1="1175" y1="330" x2="1175" y2="370" stroke="#f57c00" strokeWidth="2" markerEnd="url(#arrowhead)"/>
            <text x="1200" y="345" fontSize="10" fill="#666">contains</text>
            
            {/* 物料到供应商 */}
            <line x1="1175" y1="490" x2="1175" y2="510" stroke="#c2185b" strokeWidth="2" markerEnd="url(#arrowhead)"/>
            <text x="1180" y="505" fontSize="10" fill="#666">supplied by</text>
            
            {/* 图例和说明 */}
            <g transform="translate(1750, 100)">
              <rect width="450" height="280" fill="none" stroke="#ccc" strokeWidth="2" rx="8"/>
              <text x="225" y="25" textAnchor="middle" fontSize="16" fontWeight="bold" fill="#333">数据模型设计说明</text>
              
              <text x="15" y="50" fontSize="12" fontWeight="bold" fill="#1976d2">核心设计特点:</text>
              <text x="15" y="70" fontSize="11" fill="#333">• 分层架构: 组织核心层 → 运营活动层 → 排放计算层 → 合规治理层 → 支撑服务层</text>
              <text x="15" y="85" fontSize="11" fill="#333">• 数据驱动: Activity表作为核心数据汇聚点，支持多源异构数据</text>
              <text x="15" y="100" fontSize="11" fill="#333">• AI集成: 内置数据质量评分、置信度评估、智能填补机制</text>
              <text x="15" y="115" fontSize="11" fill="#333">• 灵活扩展: 通过code体系和JSONB字段支持业务快速迭代</text>
              
              <text x="15" y="140" fontSize="12" fontWeight="bold" fill="#d32f2f">关键数据流:</text>
              <text x="15" y="160" fontSize="11" fill="#333">1. 组织 → 运营实体 → 活动数据 → 排放计算结果</text>
              <text x="15" y="175" fontSize="11" fill="#333">2. ESG项目 → 合规记录 → 法规标准要求</text>
              <text x="15" y="190" fontSize="11" fill="#333">3. 产品 → 物料 → 供应商 → 供应链碳足迹</text>
              
              <text x="15" y="215" fontSize="12" fontWeight="bold" fill="#7b1fa2">AI/ML集成点:</text>
              <text x="15" y="235" fontSize="11" fill="#333">• 活动数据的智能识别与分类</text>
              <text x="15" y="250" fontSize="11" fill="#333">• 排放因子的智能匹配与推荐</text>
              <text x="15" y="265" fontSize="11" fill="#333">• 数据质量的自动评估与修复</text>
            </g>
            
            <g transform="translate(2250, 100)">
              <rect width="300" height="200" fill="#f8f9fa" stroke="#dee2e6" strokeWidth="1" rx="5"/>
              <text x="150" y="20" textAnchor="middle" fontSize="14" fontWeight="bold" fill="#495057">关系线图例</text>
              
              <line x1="20" y1="40" x2="80" y2="40" stroke="#1976d2" strokeWidth="3" markerEnd="url(#primaryArrow)"/>
              <text x="90" y="44" fontSize="10" fill="#333">核心业务关系</text>
              
              <line x1="20" y1="60" x2="80" y2="60" stroke="#666" strokeWidth="2" markerEnd="url(#arrowhead)"/>
              <text x="90" y="64" fontSize="10" fill="#333">标准外键关系</text>
              
              <line x1="20" y1="80" x2="80" y2="80" stroke="#666" strokeWidth="1" fill="none"/>
              <text x="90" y="84" fontSize="10" fill="#333">辅助连接线</text>
              
              <circle cx="50" cy="105" r="8" fill="#e3f2fd" stroke="#1976d2" strokeWidth="2"/>
              <text x="70" y="109" fontSize="10" fill="#333">核心实体</text>
              
              <circle cx="50" cy="125" r="6" fill="#f5f5f5" stroke="#616161" strokeWidth="1"/>
              <text x="70" y="129" fontSize="10" fill="#333">支撑实体</text>
              
              <rect x="20" y="145" width="60" height="20" fill="#f0f0f0" stroke="#757575" strokeWidth="1" rx="2"/>
              <text x="90" y="159" fontSize="10" fill="#333">查找表/关联表</text>
            </g>
            
          </svg>
        </div>
      </div>
    </div>
  );
}